package com.bjtu.lms.action.book;

import com.bjtu.lms.model.Book;
import com.bjtu.lms.service.BookService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import java.util.List;
import java.util.Map;

/**
 *
 * @author yilee
 */
public class AdminViewBookListAction extends ActionSupport {

	private BookService bookService;

	public BookService getBookService() {
		return bookService;
	}

	public void setBookService(BookService bookService) {
		this.bookService = bookService;
	}

	@Override
	public String execute() throws Exception {
		List<Book> bookList = bookService.getAllBook();
		ActionContext actionContext = ActionContext.getContext();
		Map session = actionContext.getSession();
		session.put("bookList", bookList);
		session.put("search", null);
		return SUCCESS;
	}
}
